package cn.janescott.ribboncustom;

import cn.janescott.ribboncustom.annotation.AvoidScan;
import cn.janescott.ribboncustom.configuration.EurekaClientRibbonConfiguration;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.netflix.ribbon.RibbonClient;
import org.springframework.cloud.netflix.ribbon.RibbonClients;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.FilterType;
import org.springframework.web.client.RestTemplate;

/**
 * ribbon custom
 *
 * @author scott
 */
@SpringBootApplication
@ComponentScan(
        excludeFilters = {
                @ComponentScan.Filter(type = FilterType.ANNOTATION, classes = AvoidScan.class)
        })
@RibbonClients({
        @RibbonClient(name = "EUREKA-CLIENT", configuration = EurekaClientRibbonConfiguration.class)
})
public class RibbonCustomApplication {

    public static void main(String[] args) {
        SpringApplication.run(RibbonCustomApplication.class, args);
    }

    @Bean
    @LoadBalanced
    public RestTemplate restTemplate() {
        return new RestTemplate();
    }
}

